<!--[ include file="admin_header_menu.htm" ]--><div style="clear:both"></div>

<script type="text/javascript" src="javascript/ajax/prototype.js"></script>
<script type="text/javascript">

  Event.observe(window, 'load', load);
  function load(){
	var container = document.getElementById('result');
	var param = "&ctrl=setting";
	var url = "index.php?module=InnoForum&type=ajax&func=list" + param;	
	showLoading(container);
	new Ajax.Request(url, {
	  method:'get',
	  onSuccess: function(transport){
	   var result = transport.responseText;
	   container.innerHTML= result;
	   }
	});
  }
  
  function onEditSetting(id,key,value,len){
    var container = document.getElementById('value_' + key);
    var input = "<input id='input_"+ key +"' type='input' value='"+value+"' size='"+ len +"' />";
    var operation_container = document.getElementById('operation_' + key);
    var new_operation = "<a href='#' onclick='onSave(\""+ id +"\",\""+ key +"\");return false;'><img src='<!--[ypgetbaseurl]-->modules/InnoForum/pnimages/accept.png' /></a>";	
    new_operation += "&nbsp;&nbsp;<a href='#' onclick='onCancel();return false;'><img src='<!--[ypgetbaseurl]-->modules/InnoForum/pnimages/cross.png' /></a>";
    operation_container.innerHTML = new_operation;
    container.innerHTML = input;
  }
  function onSave(id,key){
    var new_value = document.getElementById('input_' + key).value;
    var url = "index.php?module=InnoForum&type=ajax&func=save&ctrl=Setting&form[id]="+ id +"&form[value]=" + new_value;
    var container = document.getElementById('value_' + key);
    container.innerHTML = '[saving...]';
    new Ajax.Request(url, {
        method:'get',
        onSuccess: function(transport){
           //alert('saved:' + key + "," + new_value );
        window.location.reload();
         }
    });
  }
  
  function onCancel(){
    window.location.reload();
  }
  
  function showLoading(container){
    var image = "<!--[ypgetbaseurl]-->modules/InnoForum/pnimages/loading.gif";
    container.innerHTML = "<div align='center'><img src='"+ image +"' /></div>";
  }
</script>

<fieldset>
<legend>Setting information</legend>
<div id='result'></div>
</fieldset>
<BR>
<!--[include file='admin_std_footer.htm']-->